<template>
  <TitleMode
    title="民宿活动"
    :more="artistList.length > 0 ? '全部' : ''"
    id="active"
    @more="to('/pages-sub/activity/list', { createUser: artist.id })"
  />
  <div class="list" v-if="artistList.length > 0">
    <Active v-for="(item, index) in artistList" :key="index" :data="item" />
  </div>
  <Seat v-else height="260px" :loading="loading" size="mini" />
</template>
<script setup lang="ts">
import { to } from '@/utils/page'
import TitleMode from './TitleMode.vue'
import Active from '@/pages-sub/g-components/Active/index.vue'

defineOptions({ name: 'Active' })

const props = defineProps(['artist'])
const artistList = ref([])
const loading = ref(false)

if (props.artist.id) {
  getData()
}
function getData() {
  loading.value = true
  http
    .get('/activity-app/open/page', {
      createUser: props.artist.id,
      current: 1,
      size: 5,
    })
    .then((res: any) => {
      artistList.value = res.records
    })
    .finally(() => {
      loading.value = false
    })
}
</script>
<style lang="scss" scoped>
.list {
  padding: 20rpx;
  background-color: #fff;
  border-radius: 30rpx;
  :deep(.wot-theme-light:last-child) {
    .active {
      padding-bottom: 0;
      margin-bottom: 0;
      @include border-bottom(transparent);
    }
  }
}
</style>
